import axios from "axios"

const baseUrl:string = "http://192.168.124.189:8080";

// const baseUrl:string = "http://localhost:8080/";

const instance = axios.create({
    baseURL: baseUrl,
});

const token:string|null = localStorage.getItem("search_token")

instance.interceptors.request.use((request:any) => {
    if (token) {
        request.headers["search_token"] =token;
    }
    return request;
});
instance.interceptors.response.use(
    (response:any) => {
        return response.data;
    },
    async (error:string) => {

        return Promise.reject(error);
    }
);


const { get, post } = instance;

export { get, post };
